



//
//  ActivityDetailView.m
//  UI-豆瓣项目APP
//
//  Created by dllo on 15/9/9.
//  Copyright (c) 2015年 孙鹏. All rights reserved.
//

#import "ActivityDetailView.h"
#import "UIImageView+WebCache.h"
@implementation ActivityDetailView

- (instancetype)initWithFrame:(CGRect)frame
{
    
    self = [super initWithFrame:frame];
    if (self) {
        
        [self creatSubviews];
        
        
    }
    return self;
    
    
}


- (void)creatSubviews
{
    
    self.headImage = [[UIImageView alloc]initWithFrame:CGRectMake(10, 80, 120, 170)];
    [self.headImage setImage:[UIImage imageNamed:@""]];
    self.headImage.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.headImage];
    [self.headImage release];
    
    
    self.title = [[UILabel alloc]initWithFrame:CGRectMake(10, 20, 375, 30)];
    self.title.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.title];
    [self.title release];
    
    
    self.title.font = [UIFont systemFontOfSize:20];
    self.title.text = @"罗马与巴洛克艺术";
    self.title.numberOfLines = 0;
    [self.title sizeToFit];
    self.title.font = [UIFont boldSystemFontOfSize:20];
    
    
    self.picture1 = [[UIImageView alloc]initWithFrame:CGRectMake(130, 80, 20, 20)];
    [self.picture1 setImage:[UIImage imageNamed:@"icon_date_blue@2x"]];
    [self addSubview:self.picture1];
    [self.picture1 release];
    
    self.picture2 = [[UIImageView alloc]initWithFrame:CGRectMake(130, 110, 20, 20)];
    [self.picture2 setImage:[UIImage imageNamed:@"icon_sponsor_blue"]];
    [self addSubview:self.picture2];
    [self.picture2 release];
    
    self.picture3 = [[UIImageView alloc]initWithFrame:CGRectMake(130,140, 20, 20)];
    [self.picture3 setImage:[UIImage imageNamed:@"icon_catalog_blue"]];
    [self addSubview:self.picture3];
    [self.picture3 release];
    
    
    self.picture4 = [[UIImageView alloc]initWithFrame:CGRectMake(130,170, 20, 20)];
    [self.picture4 setImage:[UIImage imageNamed:@"icon_spot_blue"]];
    [self addSubview:self.picture4];
    [self.picture4 release];
    
    
    self.begin_time = [[UILabel alloc]initWithFrame:CGRectMake(150, 82,150 , 20)];
    self.begin_time.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.begin_time];
    [self.begin_time release];
    
    self.begin_time.font = [UIFont systemFontOfSize:14];
    self.begin_time.text = @"开始时间";
//    [self.begin_time sizeToFit];
    
    self.symbol = [[UILabel alloc]initWithFrame:CGRectMake(240, 82,30 , 20)];
    self.symbol.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.symbol];
    [self.symbol release];
    
    self.symbol.font = [UIFont systemFontOfSize:14];
    self.symbol.text = @"--";
    [self.symbol sizeToFit];
    
    
    
    self.end_time = [[UILabel alloc]initWithFrame:CGRectMake(260, 82,200 , 20)];
    self.end_time.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.end_time];
    [self.end_time release];
    
    self.end_time.font = [UIFont systemFontOfSize:14];
    self.end_time.text = @"结束时间";
//    [self.end_time sizeToFit];
    
    
    self.name = [[UILabel alloc]initWithFrame:CGRectMake(150, 110,200 , 20)];
    self.name.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.name];
    [self.name release];
    
    self.name.font = [UIFont systemFontOfSize:14];
    self.name.text = @"";
//    [self.name sizeToFit];

    self.category = [[UILabel alloc]initWithFrame:CGRectMake(150, 140,10 , 20)];
    self.category.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.category];
    [self.category release];
    
    self.category.font = [UIFont systemFontOfSize:14];
    self.category.text = @"类型: ";
    [self.category sizeToFit];
    
    self.category_name = [[UILabel alloc]initWithFrame:CGRectMake(190, 140,10 , 20)];
    self.category_name.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.category_name];
    [self.category_name release];
    
    self.category_name.font = [UIFont systemFontOfSize:14];
    self.category_name.text = @"类型名";
    [self.category_name sizeToFit];
    
    
    
    
    self.address = [[UILabel alloc]initWithFrame:CGRectMake(150, 170,200 , 40)];
    self.address.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.address];
    [self.address release];
    
    self.address.font = [UIFont systemFontOfSize:14];
    self.address.text = @"";
    self.address.numberOfLines = 0;
//    [self.address sizeToFit];
    
    self.activity = [[UILabel alloc]initWithFrame:CGRectMake(10, 260,100 , 30)];
    self.activity.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.activity];
    [self.activity release];
    
    
    self.activity.font = [UIFont systemFontOfSize:20];
    self.activity.text = @"活动介绍";
    self.activity.font = [UIFont boldSystemFontOfSize:20];
    [self.activity sizeToFit];
    
 
    self.label = [[UILabel alloc]initWithFrame:CGRectMake(10, 290,367 , 667 * 3)];
    self.label.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.label];
    [self.label release];
    
    self.label.font = [UIFont systemFontOfSize:14];
    self.label.text = @"";
    self.label.numberOfLines = 0;
//    [self.label sizeToFit];

    
    

}





- (void)setActList:(Activitylist *)actList{
    
    if (_actList != actList) {
        
        [_actList release];
        _actList = [actList retain];
        
    }
    
    NSString *str = [self.actList.begin_time substringWithRange:NSMakeRange(5, 11) ];
    NSString *str1 = [self.actList.end_time substringWithRange:NSMakeRange(5, 11)];
    self.title.text = self.actList.title;
    self.begin_time.text = str;
    self.end_time.text = str1;
    self.category_name.text = self.actList.category_name;
    self.address.text = self.actList.address;
    self.label.text = self.actList.content;
    [self.label sizeToFit];
    self.name.text = self.actList.name;
    

    NSURL *url = [NSURL URLWithString:self.actList.image];
    
    [self.headImage sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"placeHoderImage"]];

    
}


-(void)getHeightblock:(cgfloatBlock)block
{
    
    
    
    block(self.label.frame.size.height);
    
    
}



//+(CGFloat)heightForContent:(NSString *)content
//{
//    
//    
//    CGSize size = CGSizeMake(375, 667 * 3);
//    NSMutableDictionary *dic = [NSMutableDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:14],NSFontAttributeName, nil];
//    
//    CGRect frame = [content boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
//    
//    
//    return frame.size.height;
//    
//    
//    
//}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
